package com.asistencia.controller;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.asistencia.businness.CareerBusiness;
import com.asistencia.businness.ProfessorBusiness;
import com.asistencia.domain.Professor;
@Controller
public class ProfessorController {
	@Autowired
	private ProfessorBusiness professorBusiness;

	@Autowired
	private CareerBusiness careerBusiness;

	@RequestMapping(value = "/profesor-login.tecsup", method = RequestMethod.POST)
	public String login(Professor professor,
			@RequestParam(value = "username", required = true) String username,
			@RequestParam(value = "password", required = true) String password,
			HttpSession session, ModelMap modelMap) {
		System.out.println("Usuario: " + username + " Constrase�a: "+ password);
		professor= professorBusiness.loginProfessor(username, password);
		session.setAttribute("USER_SESSION", professor);
		return "home";
	}
}
